﻿<?php
require_once  ('SiteController.php');
class IndexController extends SiteController
{	
    public function init()
    {
    	parent::init();
    }
    public function indexAction()
    {
        
        //lấy xe nổi bật
        $this->view->featuredCars = $this->_postModel->getFeatured("car", 6);
        $arrCategories = array();
        $categories = $this->_categoryModel->getShowedCategories();
             foreach($categories as $category){
                $objCategory = new stdClass();
                $objCategory->id = $category->id;
                $objCategory->name = $category->name;
                $objCategory->slug = $category->slug;
                $objCategory->cars = $this->_postModel->getPostByCategoryID($category->id, "car", -1, true);
                $arrCategories[] = $objCategory;
              }
              $this->view->categories = $arrCategories;
    }
}